package com.buddies.lottery.ui.home;

import com.buddies.lottery.base.BasePresenter;
import com.buddies.lottery.data.BaseObserver;
import com.buddies.lottery.data.DataManager;
import com.buddies.lottery.data.resp.HomeResponse;

public class HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter {

    public HomePresenter(HomeContract.View view) {
        super(view);
    }

    @Override
    public void loadHome() {
        addSubscription(DataManager.getInstance().getLotteryRepo().getHome(), new BaseObserver<HomeResponse>() {
            @Override
            public void onNext(HomeResponse response) {
                mView.onLotteryListLoaded(response);
            }

            @Override
            public void onError(Throwable e) {
                mView.onError(e);
            }
        });
    }

}
